package com.aggregate.pay.swiftpass;

import javax.servlet.http.HttpServletRequest;

import com.aggregate.pay.swiftpass.bean.MicropayData;
import com.aggregate.pay.swiftpass.bean.MicropayResult;
import com.aggregate.pay.swiftpass.bean.NotifyData;
import com.aggregate.pay.swiftpass.bean.PayQueryData;
import com.aggregate.pay.swiftpass.bean.PayQueryResult;
import com.aggregate.pay.swiftpass.bean.RefundData;
import com.aggregate.pay.swiftpass.bean.RefundQueryData;
import com.aggregate.pay.swiftpass.bean.RefundQueryResult;
import com.aggregate.pay.swiftpass.bean.RefundResult;
import com.aggregate.pay.swiftpass.bean.ReverseData;
import com.aggregate.pay.swiftpass.bean.ReverseResult;
import com.aggregate.pay.swiftpass.bean.WeixinNativeData;
import com.aggregate.pay.swiftpass.bean.WeixinNativeResult;
import com.aggregate.pay.swiftpass.bean.WxReportSdkData;
import com.aggregate.pay.swiftpass.bean.WxReportSdkResult;
import com.aggregate.pay.swiftpass.support.Client;
import com.aggregate.pay.swiftpass.support.Config;
import com.aggregate.pay.swiftpass.support.Factory;
import com.aggregate.pay.swiftpass.support.HttpClient;
import com.aggregate.pay.swiftpass.support.Merch;
import com.aggregate.pay.swiftpass.support.client.Micropay;
import com.aggregate.pay.swiftpass.support.client.Notify;
import com.aggregate.pay.swiftpass.support.client.PayQuery;
import com.aggregate.pay.swiftpass.support.client.Refund;
import com.aggregate.pay.swiftpass.support.client.RefundQuery;
import com.aggregate.pay.swiftpass.support.client.Reverse;
import com.aggregate.pay.swiftpass.support.client.WeixinNative;
import com.aggregate.pay.swiftpass.support.client.WxReportSdk;

/**
 * 威富通支付接口工具类，相关配置和接口调用从此类开始
 * @author Moyq5
 * @date 2019年2月19日
 */
public abstract class SwiftpassApiFactory {

	public static void config(Config config, HttpClient httpClient) {
		Factory.setConfig(config);
		Factory.setHttpClient(httpClient);
	}

	@SuppressWarnings("unchecked")
	public static Client<WeixinNativeData, WeixinNativeResult> weixinNative(Merch merch) {
		return (Client<WeixinNativeData, WeixinNativeResult>)Factory.getClient(WeixinNative.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<MicropayData, MicropayResult> micropay(Merch merch) {
		return (Client<MicropayData, MicropayResult>)Factory.getClient(Micropay.class, merch);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<RefundData, RefundResult> refund(Merch merch) {
		return (Client<RefundData, RefundResult>)Factory.getClient(Refund.class, merch);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<RefundQueryData, RefundQueryResult> refundQuery(Merch merch) {
		return (Client<RefundQueryData, RefundQueryResult>)Factory.getClient(RefundQuery.class, merch);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<ReverseData, ReverseResult> reverse(Merch merch) {
		return (Client<ReverseData, ReverseResult>)Factory.getClient(Reverse.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<PayQueryData, PayQueryResult> payQuery(Merch merch) {
		return (Client<PayQueryData, PayQueryResult>)Factory.getClient(PayQuery.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<HttpServletRequest, NotifyData> payNotify(Merch merch) {
		return (Client<HttpServletRequest, NotifyData>)Factory.getClient(Notify.class, merch);
	}
	
	@SuppressWarnings("unchecked")
	public static Client<WxReportSdkData, WxReportSdkResult> wxReportSdk(Merch merch) {
		return (Client<WxReportSdkData, WxReportSdkResult>)Factory.getClient(WxReportSdk.class, merch);
	}


}
